<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="file" value="上传" id="upload" accept=".flv">

    <script src="./utf8.js"></script>
    <script src="./flv-parser.js"></script>
    <script>
        var uploadDom = document.getElementById('upload')
        uploadDom.addEventListener('change', function () {
            var file = this.files[0]
            var reader = new FileReader()
            reader.onload = function (evt) {
                var ab = evt.target.result
                var res = flvParse(ab)
                var videos = res.body.filter(v => v.TagType === 9).map(v => v.StreamData)
                var audios = res.body.filter(v => v.TagType === 8).map(v => v.StreamData)
                var scripts = res.body.filter(v => v.TagType === 18)
                console.log('videos', videos)
                console.log('audios', audios)
                console.log('scripts', scripts)
                console.log(res)
            }
            reader.readAsArrayBuffer(file)
        })
    </script>
</body>
</html>